#include<bits/stdc++.h>
#define int long long
#define ls (lr<<1)
#define rs (lr<<1|1)
#define mid ((l+r)>>1)
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
void write(int x){
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
}
const int N = 2e5+10,M = 1e6+10;
int n,sum,q,m,ap;
int a[N],ans[M],s[N];
namespace ASK{
	int t[N<<2],tag[N<<2];
	void pushup(int lr,int x){if(x) t[lr]=0,tag[lr]=1;}
	void pushdown(int lr){pushup(ls,tag[lr]),pushup(rs,tag[lr]),tag[lr]=0;}
	void modify1(int l,int r,int x,int lr){
		if(l>=x) return pushup(lr,1);
		pushdown(lr),modify1(mid+1,r,x,rs);
		if(mid>=x) modify1(l,mid,x,ls);
		t[lr] = t[ls]+t[rs];
	}
	void modify2(int l,int r,int x,int lr){
		if(l==r) return t[lr]=a[l],void();
		pushdown(lr);
		if(x<=mid) modify2(l,mid,x,ls);
		else modify2(mid+1,r,x,rs);
		t[lr] = t[ls]+t[rs];
	}
}
namespace STG{
	struct node{
		int x,v;
		bool operator < (const node &p) const {return  v==p.v?x<p.x:v<p.v;}
	}t[N<<2],ty[N<<2];
	int tag1[N<<2],tag2[N<<2];
	set<int>s;
	void build(int l,int r,int lr){
		if(l==r) return t[lr]=ty[lr]=(node){l,sum-s[l-1]},void();
		build(l,mid,ls),build(mid+1,r,rs);
		t[lr] = ty[lr] = min(t[ls],t[rs]);
	}
	void pushup(int lr,int x,int y){
		if(x) t[lr] = ty[lr],tag1[lr] = 1,tag2[lr] = 0;
		t[lr].v += y,tag2[lr] = y;
	}
	void pushdown(int lr){pushup(ls,tag1[lr],tag2[lr]),pushup(rs,tag1[lr],tag2[lr]),tag1[lr]=tag2[lr]=0;}
	void modify1(int l,int r,int x,int lr){
		if(l>=x) return pushup(lr,1,0);
		pushdown(lr),modify1(mid+1,r,x,rs);
		if(mid>=x) modify1(l,mid,x,ls);
		t[lr] = min(t[ls],t[rs]);
	}
	void modify2(int l,int r,int L,int R,int x,int lr){
		if(l>=L and r<=R) return pushup(lr,0,x);
		pushdown(lr);
		if(mid>=L) modify2(l,mid,L,R,x,ls);
		if(mid<R) modify2(mid+1,r,L,R,x,rs);
		t[lr] = min(t[ls],t[rs]);
	}
	void update(int &x,int now){
		node l = t[1];
//		cout<<x<<" "<<l.x<<" "<<l.v<<endl;
		if(x<l.v) return;
	 	x -= l.v;
	 	ASK::modify1(1,m,l.x,1);
		ASK::modify2(1,m,l.x,1);
		modify1(1,m,l.x,1);
		modify2(1,m,1,l.x,-l.v,1);
		modify2(1,m,l.x,n,now+ASK::t[1]-sum,1);
		modify2(1,m,l.x,n,l.v,1);
		modify2(1,m,l.x,l.x,M,1);
	}
}
void init(){
	STG::build(1,m,1);
	for(int i = 1,j = 1;i<=sum;i++,j++){
		STG::update(j,sum-i),ans[sum-i] = abs(ASK::t[1]-i+ASK::t[1]);
//		cout<<sum-i<<" "<<ASK::t[1]+sum-i<<" "<<sum-ASK::t[1]<<endl;
//		cout<<ASK::t[1]<<endl;
	}
//	for(int i = 1;i<=sum;i++) cout<<ans[i]<<" ";cout<<endl;
}
signed main(){
	freopen("pockets.in","r",stdin);
	freopen("pockets.out","w",stdout);
	n = read(),ap = read(),ap -= read(),n -= 2,m = n-1;
	for(int i = 1;i<n;i++) a[i] = read();
	reverse(a+1,a+n);
	for(int i = 1;i<n;i++) s[i] = a[i]+s[i-1];
	sum = s[m],init(),q = read();
	while(q--){
		int x = read(),res = (x>sum?x-sum:ans[x]);
		write(res+ap),putchar('\n');
	}
	return 0;
}

